package com.hu.video.controller;

import com.hu.video.service.ISocialVideoLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/video/like")
public class SocialVideoLikeController {
    @Autowired
    private ISocialVideoLikeService likeService;

    @PostMapping("/{videoId}/{userId}")
    public boolean like(@PathVariable Long videoId, @PathVariable Long userId) {
        return likeService.likeVideo(videoId, userId);
    }

    @DeleteMapping("/{videoId}/{userId}")
    public boolean unlike(@PathVariable Long videoId, @PathVariable Long userId) {
        return likeService.unlikeVideo(videoId, userId);
    }

    @GetMapping("/count/{videoId}")
    public int count(@PathVariable Long videoId) {
        return likeService.getLikeCount(videoId);
    }

    @GetMapping("/isLiked/{videoId}/{userId}")
    public boolean isLiked(@PathVariable Long videoId, @PathVariable Long userId) {
        return likeService.isLiked(videoId, userId);
    }
} 